<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .bb {
            height: 100px;
        }

        .box {
            background: green;
            width: 100px;
            height: 100px;
            position: absolute;
        }

        .bb {
            position: relative;
        }
    </style>
</head>

<body>
    <div class="bb">
        <button class="btn">show</button>
        <button class="btn1">fade</button>
        <button class="btn2">slide</button>

        <button class="btn3">auto</button>

        <button class="btn4">组合拳</button>
    </div>
    <div class="bb">
        <div class="box"></div>
    </div>


    <script src="../js/jquery.js"></script>

    <script>
        $(".btn").on("click", () => {
            $(".box").toggle(2000);
        })

        $(".btn1").on("click", () => {
            $(".box").fadeToggle(2000);
        })

        $(".btn2").on("click", () => {
            $(".box").slideToggle(2000);
        })

        $(".btn3").on("click", () => {
            $(".box").fadeToggle(2000, function () {
                $(".box").fadeToggle(2000, arguments.callee)
            })
        })

        $(".btn4").on("click", function () {
            $(".box").queue(function (next) {
                $(this).css({
                    background: "blue"
                })
                next();
            })
                .animate({
                    left: 300
                }, 1000).animate({
                    top: 300
                }, 1000).queue(function (next) {
                    $(this).css({
                        background: "green"
                    })
                    next()
                }).animate({
                    left: 0
                }, 1000)
                .animate({
                    top: 0
                }, 1000, arguments.callee)
        })
    </script>


</body>

</html>